/*
 ============================================================================
 Name		: CAutoTimer.h
 Author	  : 
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CCAutoTimer declaration
 ============================================================================
 */

#ifndef CAUTOTIMER_H
#define CAUTOTIMER_H

#include <e32base.h>	// For CActive, link against: euser.lib
#include <e32std.h>		// For RTimer, link against: euser.lib
class CAutoTimer : public CActive
{
public:
	// Cancel and destroy
	~CAutoTimer();

	// Two-phased constructor.
	static CAutoTimer* NewL();

	// Two-phased constructor.
	static CAutoTimer* NewLC();
	
	void StartTimer(TInt aTimerValue);
	void ResetIndex();
	
	
private:
	// C++ constructor
	CAutoTimer();

	// Second-phase constructor
	void ConstructL();

private:
	// From CActive
	// Handle completion
	void RunL();

	// How to cancel me
	void DoCancel();

	// Override to handle leaves from RunL(). Default implementation causes
	// the active scheduler to panic.
	TInt RunError(TInt aError);

private:
	TInt iIndex; // State of the active object
	RTimer iTimer; // Provides async timing service

};

#endif // CAUTOTIMER_H
